<template>
	<view :class="currentTheme">
		<a-nabbar name="票据列表" />
		<view v-for="(a,index) in ticketIds" :key="index" class="u-padding-left-32 u-padding-right-32 u-padding-top-20">
			<item-box :padding="30">
				<view class="u-font-22 u-flex u-row-between">
					<text class="text-order-time u-font-24">{{a | formatId}}</text>
					<text class="text-color-765CFE" @click="copy(a)">复制</text>
				</view>
			</item-box>
		</view>
	</view>
</template>

<script>
	import {getDetail} from '@/api/crud.js'
	export default {
		data() {
			return {
				apiModule:'shopApi',
				apiType:'storeOrder',
				ticketIds:[]
			};
		},
		onLoad(option) {
			getDetail({},this.apiType,this.apiModule,option.id).then(res=>{
				this.ticketIds  = res.ticketIds
			})
		},
		methods:{
			copy(val){
				uni.setClipboardData({
					data:val,
					success: () => {
						this.$u.toast('复制成功')
					},
					fail: () => {
						this.$u.toast('复制失败')
					}
				})
			},
		},
		filters:{
			formatId(val){
				if(val){
					const flag = val.indexOf('F')>-1;
					return `${flag ? '发行票':'店家票'}: ${val}`
				}
			}
		}
	}
</script>

<style lang="scss">

</style>
